\(\int \frac {1}{\sqrt {a+b \csc ^2(c+d x)}} \, dx\) [12]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [F(-2)]
   Mupad [F(-1)]

Optimal result

Integrand size = 16, antiderivative size = 39 \[ \int \frac {1}{\sqrt {a+b \csc ^2(c+d x)}} \, dx=-\frac {\arctan \left (\frac {\sqrt {a} \cot (c+d x)}{\sqrt {a+b \csc ^2(c+d x)}}\right )}{\sqrt {a} d} \]

[Out]

-arctan(cot(d*x+c)*a^(1/2)/(a+b*csc(d*x+c)^2)^(1/2))/d/a^(1/2)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.03, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.188, Rules used = {4213, 385, 209} \[ \int \frac {1}{\sqrt {a+b \csc ^2(c+d x)}} \, dx=-\frac {\arctan \left (\frac {\sqrt {a} \cot (c+d x)}{\sqrt {a+b \cot ^2(c+d x)+b}}\right )}{\sqrt {a} d} \]

[In]

Int[1/Sqrt[a + b*Csc[c + d*x]^2],x]

[Out]

-(ArcTan[(Sqrt[a]*Cot[c + d*x])/Sqrt[a + b + b*Cot[c + d*x]^2]]/(Sqrt[a]*d))

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 385

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Subst[Int[1/(c - (b*c - a*d)*x^n), x]
, x, x/(a + b*x^n)^(1/n)] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && EqQ[n*p + 1, 0] && IntegerQ[n]

Rule 4213

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist
[ff/f, Subst[Int[(a + b + b*ff^2*x^2)^p/(1 + ff^2*x^2), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p},
 x] && NeQ[a + b, 0] && NeQ[p, -1]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {1}{\left (1+x^2\right ) \sqrt {a+b+b x^2}} \, dx,x,\cot (c+d x)\right )}{d} \\ & = -\frac {\text {Subst}\left (\int \frac {1}{1+a x^2} \, dx,x,\frac {\cot (c+d x)}{\sqrt {a+b+b \cot ^2(c+d x)}}\right )}{d} \\ & = -\frac {\arctan \left (\frac {\sqrt {a} \cot (c+d x)}{\sqrt {a+b+b \cot ^2(c+d x)}}\right )}{\sqrt {a} d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(98\) vs. \(2(39)=78\).

Time = 0.29 (sec) , antiderivative size = 98, normalized size of antiderivative = 2.51 \[ \int \frac {1}{\sqrt {a+b \csc ^2(c+d x)}} \, dx=-\frac {\sqrt {-a-2 b+a \cos (2 (c+d x))} \csc (c+d x) \log \left (\sqrt {2} \sqrt {a} \cos (c+d x)+\sqrt {-a-2 b+a \cos (2 (c+d x))}\right )}{\sqrt {2} \sqrt {a} d \sqrt {a+b \csc ^2(c+d x)}} \]

[In]

Integrate[1/Sqrt[a + b*Csc[c + d*x]^2],x]

[Out]

-((Sqrt[-a - 2*b + a*Cos[2*(c + d*x)]]*Csc[c + d*x]*Log[Sqrt[2]*Sqrt[a]*Cos[c + d*x] + Sqrt[-a - 2*b + a*Cos[2
*(c + d*x)]]])/(Sqrt[2]*Sqrt[a]*d*Sqrt[a + b*Csc[c + d*x]^2]))

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(164\) vs. \(2(33)=66\).

Time = 2.42 (sec) , antiderivative size = 165, normalized size of antiderivative = 4.23

method result size
default \(-\frac {\sqrt {-\frac {a \cos \left (d x +c \right )^{2}-a -b}{\left (\cos \left (d x +c \right )+1\right )^{2}}}\, \ln \left (4 \sqrt {-\frac {a \cos \left (d x +c \right )^{2}-a -b}{\left (\cos \left (d x +c \right )+1\right )^{2}}}\, \cos \left (d x +c \right ) \sqrt {-a}+4 \sqrt {-a}\, \sqrt {-\frac {a \cos \left (d x +c \right )^{2}-a -b}{\left (\cos \left (d x +c \right )+1\right )^{2}}}-4 \cos \left (d x +c \right ) a \right ) \left (\csc \left (d x +c \right )+\cot \left (d x +c \right )\right ) \sqrt {4}}{2 d \sqrt {a +b \csc \left (d x +c \right )^{2}}\, \sqrt {-a}}\) \(165\)

[In]

int(1/(a+b*csc(d*x+c)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-1/2/d*(-(a*cos(d*x+c)^2-a-b)/(cos(d*x+c)+1)^2)^(1/2)*ln(4*(-(a*cos(d*x+c)^2-a-b)/(cos(d*x+c)+1)^2)^(1/2)*cos(
d*x+c)*(-a)^(1/2)+4*(-a)^(1/2)*(-(a*cos(d*x+c)^2-a-b)/(cos(d*x+c)+1)^2)^(1/2)-4*cos(d*x+c)*a)/(a+b*csc(d*x+c)^
2)^(1/2)*(csc(d*x+c)+cot(d*x+c))*4^(1/2)/(-a)^(1/2)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 150 vs. \(2 (33) = 66\).

Time = 0.33 (sec) , antiderivative size = 414, normalized size of antiderivative = 10.62 \[ \int \frac {1}{\sqrt {a+b \csc ^2(c+d x)}} \, dx=\left [-\frac {\sqrt {-a} \log \left (128 \, a^{4} \cos \left (d x + c\right )^{8} - 256 \, {\left (a^{4} + a^{3} b\right )} \cos \left (d x + c\right )^{6} + 160 \, {\left (a^{4} + 2 \, a^{3} b + a^{2} b^{2}\right )} \cos \left (d x + c\right )^{4} + a^{4} + 4 \, a^{3} b + 6 \, a^{2} b^{2} + 4 \, a b^{3} + b^{4} - 32 \, {\left (a^{4} + 3 \, a^{3} b + 3 \, a^{2} b^{2} + a b^{3}\right )} \cos \left (d x + c\right )^{2} + 8 \, {\left (16 \, a^{3} \cos \left (d x + c\right )^{7} - 24 \, {\left (a^{3} + a^{2} b\right )} \cos \left (d x + c\right )^{5} + 10 \, {\left (a^{3} + 2 \, a^{2} b + a b^{2}\right )} \cos \left (d x + c\right )^{3} - {\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a} \sqrt {\frac {a \cos \left (d x + c\right )^{2} - a - b}{\cos \left (d x + c\right )^{2} - 1}} \sin \left (d x + c\right )\right )}{8 \, a d}, \frac {\arctan \left (\frac {{\left (8 \, a^{2} \cos \left (d x + c\right )^{4} - 8 \, {\left (a^{2} + a b\right )} \cos \left (d x + c\right )^{2} + a^{2} + 2 \, a b + b^{2}\right )} \sqrt {a} \sqrt {\frac {a \cos \left (d x + c\right )^{2} - a - b}{\cos \left (d x + c\right )^{2} - 1}} \sin \left (d x + c\right )}{4 \, {\left (2 \, a^{3} \cos \left (d x + c\right )^{5} - 3 \, {\left (a^{3} + a^{2} b\right )} \cos \left (d x + c\right )^{3} + {\left (a^{3} + 2 \, a^{2} b + a b^{2}\right )} \cos \left (d x + c\right )\right )}}\right )}{4 \, \sqrt {a} d}\right ] \]

[In]

integrate(1/(a+b*csc(d*x+c)^2)^(1/2),x, algorithm="fricas")

[Out]

[-1/8*sqrt(-a)*log(128*a^4*cos(d*x + c)^8 - 256*(a^4 + a^3*b)*cos(d*x + c)^6 + 160*(a^4 + 2*a^3*b + a^2*b^2)*c
os(d*x + c)^4 + a^4 + 4*a^3*b + 6*a^2*b^2 + 4*a*b^3 + b^4 - 32*(a^4 + 3*a^3*b + 3*a^2*b^2 + a*b^3)*cos(d*x + c
)^2 + 8*(16*a^3*cos(d*x + c)^7 - 24*(a^3 + a^2*b)*cos(d*x + c)^5 + 10*(a^3 + 2*a^2*b + a*b^2)*cos(d*x + c)^3 -
 (a^3 + 3*a^2*b + 3*a*b^2 + b^3)*cos(d*x + c))*sqrt(-a)*sqrt((a*cos(d*x + c)^2 - a - b)/(cos(d*x + c)^2 - 1))*
sin(d*x + c))/(a*d), 1/4*arctan(1/4*(8*a^2*cos(d*x + c)^4 - 8*(a^2 + a*b)*cos(d*x + c)^2 + a^2 + 2*a*b + b^2)*
sqrt(a)*sqrt((a*cos(d*x + c)^2 - a - b)/(cos(d*x + c)^2 - 1))*sin(d*x + c)/(2*a^3*cos(d*x + c)^5 - 3*(a^3 + a^
2*b)*cos(d*x + c)^3 + (a^3 + 2*a^2*b + a*b^2)*cos(d*x + c)))/(sqrt(a)*d)]

Sympy [F]

\[ \int \frac {1}{\sqrt {a+b \csc ^2(c+d x)}} \, dx=\int \frac {1}{\sqrt {a + b \csc ^{2}{\left (c + d x \right )}}}\, dx \]

[In]

integrate(1/(a+b*csc(d*x+c)**2)**(1/2),x)

[Out]

Integral(1/sqrt(a + b*csc(c + d*x)**2), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 987 vs. \(2 (33) = 66\).

Time = 0.46 (sec) , antiderivative size = 987, normalized size of antiderivative = 25.31 \[ \int \frac {1}{\sqrt {a+b \csc ^2(c+d x)}} \, dx=\text {Too large to display} \]

[In]

integrate(1/(a+b*csc(d*x+c)^2)^(1/2),x, algorithm="maxima")

[Out]

1/2*(arctan2(2*a*sin(2*d*x + 2*c) + 2*(a^2*cos(4*d*x + 4*c)^2 + a^2*sin(4*d*x + 4*c)^2 + 4*(a^2 + 4*a*b + 4*b^
2)*cos(2*d*x + 2*c)^2 - 4*(a^2 + 2*a*b)*sin(4*d*x + 4*c)*sin(2*d*x + 2*c) + 4*(a^2 + 4*a*b + 4*b^2)*sin(2*d*x
+ 2*c)^2 + a^2 + 2*(a^2 - 2*(a^2 + 2*a*b)*cos(2*d*x + 2*c))*cos(4*d*x + 4*c) - 4*(a^2 + 2*a*b)*cos(2*d*x + 2*c
))^(1/4)*sqrt(a)*sin(1/2*arctan2(a*sin(4*d*x + 4*c) - 2*(a + 2*b)*sin(2*d*x + 2*c), a*cos(4*d*x + 4*c) - 2*(a
+ 2*b)*cos(2*d*x + 2*c) + a)), 2*a*cos(2*d*x + 2*c) + 2*(a^2*cos(4*d*x + 4*c)^2 + a^2*sin(4*d*x + 4*c)^2 + 4*(
a^2 + 4*a*b + 4*b^2)*cos(2*d*x + 2*c)^2 - 4*(a^2 + 2*a*b)*sin(4*d*x + 4*c)*sin(2*d*x + 2*c) + 4*(a^2 + 4*a*b +
 4*b^2)*sin(2*d*x + 2*c)^2 + a^2 + 2*(a^2 - 2*(a^2 + 2*a*b)*cos(2*d*x + 2*c))*cos(4*d*x + 4*c) - 4*(a^2 + 2*a*
b)*cos(2*d*x + 2*c))^(1/4)*sqrt(a)*cos(1/2*arctan2(a*sin(4*d*x + 4*c) - 2*(a + 2*b)*sin(2*d*x + 2*c), a*cos(4*
d*x + 4*c) - 2*(a + 2*b)*cos(2*d*x + 2*c) + a)) - 2*a - 4*b) + arctan2(2*(a^2*cos(4*d*x + 4*c)^2 + a^2*sin(4*d
*x + 4*c)^2 + 4*(a^2 + 4*a*b + 4*b^2)*cos(2*d*x + 2*c)^2 - 4*(a^2 + 2*a*b)*sin(4*d*x + 4*c)*sin(2*d*x + 2*c) +
 4*(a^2 + 4*a*b + 4*b^2)*sin(2*d*x + 2*c)^2 + a^2 + 2*(a^2 - 2*(a^2 + 2*a*b)*cos(2*d*x + 2*c))*cos(4*d*x + 4*c
) - 4*(a^2 + 2*a*b)*cos(2*d*x + 2*c))^(1/4)*sqrt(a)*sin(1/2*arctan2(a*sin(4*d*x + 4*c) - 2*(a + 2*b)*sin(2*d*x
 + 2*c), a*cos(4*d*x + 4*c) - 2*(a + 2*b)*cos(2*d*x + 2*c) + a)), 2*(a^2*cos(4*d*x + 4*c)^2 + a^2*sin(4*d*x +
4*c)^2 + 4*(a^2 + 4*a*b + 4*b^2)*cos(2*d*x + 2*c)^2 - 4*(a^2 + 2*a*b)*sin(4*d*x + 4*c)*sin(2*d*x + 2*c) + 4*(a
^2 + 4*a*b + 4*b^2)*sin(2*d*x + 2*c)^2 + a^2 + 2*(a^2 - 2*(a^2 + 2*a*b)*cos(2*d*x + 2*c))*cos(4*d*x + 4*c) - 4
*(a^2 + 2*a*b)*cos(2*d*x + 2*c))^(1/4)*sqrt(a)*cos(1/2*arctan2(a*sin(4*d*x + 4*c) - 2*(a + 2*b)*sin(2*d*x + 2*
c), a*cos(4*d*x + 4*c) - 2*(a + 2*b)*cos(2*d*x + 2*c) + a)) - 4*b))/(sqrt(a)*d)

Giac [F(-2)]

Exception generated. \[ \int \frac {1}{\sqrt {a+b \csc ^2(c+d x)}} \, dx=\text {Exception raised: TypeError} \]

[In]

integrate(1/(a+b*csc(d*x+c)^2)^(1/2),x, algorithm="giac")

[Out]

Exception raised: TypeError >> an error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Error: Bad Argument Type

Mupad [F(-1)]

Timed out. \[ \int \frac {1}{\sqrt {a+b \csc ^2(c+d x)}} \, dx=\int \frac {1}{\sqrt {a+\frac {b}{{\sin \left (c+d\,x\right )}^2}}} \,d x \]

[In]

int(1/(a + b/sin(c + d*x)^2)^(1/2),x)

[Out]

int(1/(a + b/sin(c + d*x)^2)^(1/2), x)